#pragma once

#include "DX11Includes.h"
#include <string>

using namespace std;

struct VectorData
{
	XMVECTOR* mValue;
	double mTime;

	// Comparison operators. For use with std::find();
	bool operator == (const VectorData& o) const {
		return o.mValue == this->mValue;
	}
	bool operator != (const VectorData& o) const {
		return o.mValue != this->mValue;
	}

	// Relational operators. For use with std::sort();
	bool operator < (const VectorData& o) const {
		return mTime < o.mTime;
	}
	bool operator > (const VectorData& o) const {
		return mTime > o.mTime;
	}

};

enum AnimBehaviour
{
	/** The value from the default node transformation is taken*/
	AnimBehaviour_DEFAULT  = 0x0,  

	/** The nearest key value is used without interpolation */
	AnimBehaviour_CONSTANT = 0x1,

	/** The value of the nearest two keys is linearly
	 *  extrapolated for the current time value.*/
	AnimBehaviour_LINEAR   = 0x2,

	/** The animation is repeated.
	 *
	 *  If the animation key go from n to m and the current
	 *  time is t, use the value at (t-n) % (|m-n|).*/
	AnimBehaviour_REPEAT   = 0x3	
};

class AnimNodeData
{
public:
	AnimNodeData(void);
	~AnimNodeData(void);

	/** The name of the node affected by this animation. The node 
	 *  must exist and it must be unique.*/
	string mNodeName;

	/** The number of position keys */
	unsigned int mNumPositionKeys;

	/** The position keys of this animation channel. Positions are 
	 * specified as 3D vector. The array is mNumPositionKeys in size.
	 *
	 * If there are position keys, there will also be at least one
	 * scaling and one rotation key.*/
	VectorData* mPositionKeys;

	/** The number of rotation keys */
	unsigned int mNumRotationKeys;

	/** The rotation keys of this animation channel. Rotations are 
	 *  given as quaternions,  which are 4D vectors. The array is 
	 *  mNumRotationKeys in size.
	 *
	 * If there are rotation keys, there will also be at least one
	 * scaling and one position key. */
	VectorData* mRotationKeys;


	/** The number of scaling keys */
	unsigned int mNumScalingKeys;

	/** The scaling keys of this animation channel. Scalings are 
	 *  specified as 3D vector. The array is mNumScalingKeys in size.
	 *
	 * If there are scaling keys, there will also be at least one
	 * position and one rotation key.*/
	VectorData* mScalingKeys;


	/** Defines how the animation behaves before the first
	 *  key is encountered.
	 *
	 *  The default value is aiAnimBehaviour_DEFAULT (the original
	 *  transformation matrix of the affected node is used).*/
	AnimBehaviour mPreState;

	/** Defines how the animation behaves after the last 
	 *  key was processed.
	 *
	 *  The default value is aiAnimBehaviour_DEFAULT (the original
	 *  transformation matrix of the affected node is taken).*/
	AnimBehaviour mPostState;

};
